package com.listview;

import android.content.*;
import android.graphics.*;
import android.view.*;
import android.widget.*;

import com.formen.ndk.*;

public class SnsArrayAdapter extends ArrayAdapter<String> {
	private final Context context;
	private final String[] values;


	public SnsArrayAdapter(Context context, String[] values) {
		super(context, R.layout.sns_list, values);
		this.context = context;
		this.values = values;

	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View rowView = inflater.inflate(R.layout.sns_list, parent, false);

		TextView textView = (TextView) rowView.findViewById(R.id.lbName);
		TextView textView2 = (TextView) rowView.findViewById(R.id.label2);
		TextView textView3 = (TextView) rowView.findViewById(R.id.label3);

		if (position % 2 == 0) {
			rowView.setBackgroundColor(Color.parseColor("#CCCCCC"));
			textView.setTextColor(Color.parseColor("#006400"));
			textView2.setTextColor(Color.parseColor("#006400"));
			textView3.setTextColor(Color.parseColor("#006400"));
		} else {
			rowView.setBackgroundColor(Color.parseColor("#F08080"));
			textView.setTextColor(Color.WHITE);
			textView2.setTextColor(Color.WHITE);
			textView3.setTextColor(Color.WHITE);
		}

		if (position == 0) {
			rowView.setBackgroundColor(Color.parseColor("#800000"));
			textView.setTextColor(Color.WHITE);
			textView2.setTextColor(Color.WHITE);
			textView3.setTextColor(Color.WHITE);
		}

		textView.setTextSize(18);
		textView2.setTextSize(18);
		textView3.setTextSize(18);

		textView.setText(values[position].split("\t")[1]);
		textView2.setText(values[position].split("\t")[6]);
		if (position == 0) {
			textView3.setText(values[position].split("\t")[5]);
		} else {
			textView3.setText(values[position].split("\t")[5].substring(0, 10));
		}
		// Change icon based on name
		String s = values[position];

		System.out.println(s);

		return rowView;
	}
}